import Vue from 'vue'
import Router from 'vue-router'
import routes from './routes'
import role from './role'
import ViewUi from 'view-design'

Vue.use(Router)

const router = new Router({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

router.beforeEach((to, from, next) => {
  ViewUi.LoadingBar.start();
  // role(to, from, next);
  next();
})

router.afterEach(route => {
  ViewUi.LoadingBar.finish();
});

export default router;